function Get-FileInfos([ValidateNotNullOrEmpty()][string]$Directory, [string[]]$IgnorePaths) {
    $fileInfos = [System.Collections.Generic.List[System.Io.FileInfo]]::new()
    $currentDirectory = [System.IO.DirectoryInfo]::new($Directory);
    $stack = [System.Collections.Generic.Stack[System.Io.DirectoryInfo]]::new()
    $stack.Push($currentDirectory)

    while ([System.Linq.Enumerable]::Any($stack)) {
        $currentDirectory = $stack.Pop()
        $fileInfos.AddRange($currentDirectory.GetFiles())
        $childDirs = $currentDirectory.GetDirectories()

        foreach ($childDir in $childDirs) {
            # 仅根据目录名名称忽略
            if (![System.Linq.Enumerable]::Any($IgnorePaths, [Func[System.String, System.Boolean]] {
                        param($item)
                        return $childDir.FullName.EndsWith($item)
                    })) {
                $stack.Push($childDir);
            }
        }
    }
    return  $fileInfos.ToArray()
}